import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

public class TestLinkedHashMap {

	public static void main(String args[]) {

		Map<Integer, List> map = new LinkedHashMap<Integer, List>();
		
		List<String> arrylist = new ArrayList<String>();
		String arr1 = "a";
		String arr2 = "b";
		String arr3 = "c";
		String arr4 = "d";
		int a = 1;
		int b = 1;
		int c = 3;
		arrylist.add(arr1);
		arrylist.add(arr2);
		map.put(a, arrylist);
		prt(map);
		arrylist =  new ArrayList<String>();
		arrylist.add(arr3);
		map.put(a, arrylist);
		prt(map);
		 Random random1 = new Random(100);
         System.out.println(Math.abs(random1.nextInt()));
	}
	
	public static void prt(Map<Integer, List> map){
		Iterator it1 = null;
		Map.Entry entry = null;
		it1 = map.entrySet().iterator();
		while (it1.hasNext()) {
			entry = (Map.Entry) it1.next();
			System.out.println("key: " + entry.getKey() );
			ArrayList list =(ArrayList) entry.getValue();
			int len= list.size();
			for(int i=0;i<len;i++){
				System.out.println(list.get(i));
			}
		}
	}
	
}
